package gameTheory;

import java.util.HashMap;
import java.util.Set;

import model.Route;
import graphs.Graph;

public class PureProfileGenerator extends ProfileGenerator {
	
	public PureProfileGenerator(Graph g) {
		super(g);
	}

	protected void createProfiles(Graph g){
		Set<Route> routes = g.getAllRoutes();
		
		for (Route route : routes)
			player.add(createPureStrategy(route,routes));
		
		for(Route route : routes)
			others.add(createPureStrategy(route, routes));
		
		for(Strategy ps : player){
			for(Strategy os : others)
				profiles.add(new Profile(ps,os,g));
		}
	}
	
	private Strategy createPureStrategy(Route route, Set<Route> routes) {
		HashMap<Route,Double> probs = new HashMap<Route,Double>();
		for(Route r : routes) {
			if(r == route)
				probs.put(r, 1.0);
			else
				probs.put(r, 0.0);
		}
		return new Strategy(probs);
	}
}
